<@head title="注册-vmvm资源分享网站"><!--2222222--->
</@head>
<@body shownav=false>


 <form class="form-signin" >
      <div class="text-center mb-4">

        <h1 class="h3 mb-3 font-weight-normal">新用户注册</h1>
        <p>你好，该网站是必须要注册才能浏览的网址，请您先<code>注册</code>， 如果您已经此账号可以直接 <a href="login">登录</a></p>
      </div>

      <div class="form-label-group">
        <label for="inputEmail">昵称:</label>
        <input type="text" id="fullName" name="fullName" class="form-control" placeholder="" required autofocus>

      </div>
      <div class="form-label-group">
        <label for="inputEmail">登陆账号:</label>
        <input type="text" id="username" name="username" class="form-control" placeholder="" required  >

      </div>

      <div class="form-label-group">
        <label for="inputPassword">密码:</label>
        <input type="password" name="passwd" id="passwd" class="form-control" placeholder="" required>

      </div>
      <div class="form-label-group">
        <label for="inputPassword">再次确认密码:</label>
        <input type="password" name="passwd2" id="passwd2" class="form-control" placeholder="" required>

      </div>


      <div class="form-label-group">
        <label for="inputPassword">验证码:</label>
        <input type="number" name="captcha" id="captcha" class="form-control" placeholder="" required autocomplete="off">
<img id="captchaimg"  src="/captcha"/>
      </div>



      <div class="checkbox mb-3">
        <label>
          <input type="checkbox" name="age" value="remember-me" required> 我已经满18岁
        </label>
      </div>
      <button class="btn btn-lg btn-primary btn-block" type="submit"> 注 册 </button>
      <p class="mt-5 mb-3 text-muted text-center">&copy; 2017-2019 去<a href="/">首页</a></p>
    </form>

</@body>







<@js>


$("form").submit(function(e){
    e.preventDefault();
$.post("register", $("form").serialize(),
          function(data){
             console.log(data); //  2pm
             if(data.code==200){
                window.location.href='/';
                return;
            }
            $("#captchaimg").click();  alert(data.message);
         }, "json");

});

$("#captchaimg").click(function(){
  $("#captchaimg").attr("src","/captcha?"+Math.random());
  $("#captcha").val("");
});


</@js>